<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org" lang="zh">
<head th:replace="common/header::header"/>
<body>
<article class="page-container">
    <form class="form form-horizontal" id="form-menu-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>菜单名称：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="" placeholder="" id="menuName" name="menuName" th:attr="value=(${menu}?(${menu.menuName}):'')" style="width: 410px"/>
            </div>
        </div>
        <span th:if="${menu}">
            <input type="hidden" name="menuId" id="menuId" th:value="${menu.menuId}"/>
        </span>
        <div th:if="${menu}">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>父级菜单：</label>
                <div class="formControls col-xs-8 col-sm-8">
                <span class="select-box" style="width:410px;">
                    <select class="select" name="parentId" size="1">
                        <option id="btn" th:value="${menu.menuId}" th:text="${menu.menuName}"></option>
                        <option th:each="menuItem:${menus}" th:text="${menuItem.menuName}" th:value="${menuItem.menuId}"></option>
                    </select>
			    </span>
                </div>
            </div>
        </div>
        <div th:unless="${menu}">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>父级菜单：</label>
                <div class="formControls col-xs-8 col-sm-8">
                <span class="select-box" style="width:410px;">
                    <select class="select" name="parentId" size="1">
                        <option value="">---请选择父级菜单---</option>
                        <option th:each="menuItem:${menus}" th:text="${menuItem.menuName}" th:value="${menuItem.menuId}"></option>
                    </select>
			    </span>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>菜单路径：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" name="menuUrl" id="menuUrl" th:attr="value=(${menu}?(${menu.menuUrl}):'')" style="width: 410px"/>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>菜单图标：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" placeholder="" id="menuIcon" name="menuIcon" th:attr="value=(${menu}?(${menu.menuIcon}):'')" style="width: 410px"/>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>展示顺序：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" placeholder="" id="menuIndex" name="menuIndex" th:attr="value=(${menu}?(${menu.menuIndex}):'')" style="width: 410px"/>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>菜单权限：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" placeholder="" id="permission" name="permission" th:attr="value=(${menu}?(${menu.permission}):'')" style="width: 410px"/>
            </div>
        </div>
        <div th:if="${menu}">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">是否启用：</label>
                <div class="formControls col-xs-8 col-sm-8">
                <span class="select-box" style="width:410px;">
                    <select class="select" name="status" size="1" th:switch="${menu.status}">
                        <option th:text="${menu.status}==1?'启用':'禁用'" th:attr="value=${menu.status}"></option>
                        <option th:text="${menu.status}==0?'启用':'禁用'" th:attr="value=(${menu.status}==1?'0':'1')"></option>

                    </select>
			    </span>
                </div>
            </div>
        </div>
        <div th:unless="${menu}">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">是否启用：</label>
                <div class="formControls col-xs-8 col-sm-8">
                    <span class="select-box" style="width:410px;">
                        <select class="select" name="status" size="1">
                            <option value="0">禁用</option>
                            <option value="1">启用</option>
                        </select>
                    </span>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">备注：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <textarea name="remark" id="remark" class="textarea"  placeholder="" th:text="${menu}?(${menu.remark}):''" style="width: 410px"></textarea>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" id="sub" value="&nbsp;&nbsp;提交&nbsp;&nbsp;"/>
                <button onclick="layer_close()" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</article>
<script th:src="@{/js/permission/menu/menuAdd.js}" th:inline="javascript"/>
</body>
</html>